import express from 'express';
import type { Express, Request, Response } from 'express';
import cors from 'cors';
import helmet from 'helmet';
import compression from 'compression';

function createTestApp(): Express {
  const app: Express = express();

  // 基础中间件
  app.use(helmet());
  app.use(cors());
  app.use(compression());
  app.use(express.json());

  // 健康检查
  app.get('/health', (_req: Request, res: Response): void => {
    res.json({ status: 'ok' });
  });

  return app;
}

export default createTestApp;
